package be.lioche.soupe.kits;

import org.bukkit.GameMode;
import org.bukkit.Material;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player;
import org.bukkit.event.Listener;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;

import be.lioche.soupe.Main;
import be.lioche.soupe.Spawn;

public class Freezer implements Listener{

	public Main plugin;
	public Freezer(Main main) {
		this.plugin = main;
	}
	
	public static void lvl1(Player p){

		ItemStack casque = new ItemStack(Material.IRON_HELMET);
		ItemStack plastron = new ItemStack(Material.IRON_CHESTPLATE);
		ItemStack pantalon = new ItemStack(Material.IRON_LEGGINGS);
		ItemStack bottes = new ItemStack(Material.IRON_BOOTS);

		ItemStack epee = new ItemStack(Material.IRON_SWORD);
		ItemStack arc = new ItemStack(Material.BOW);
		ItemStack ender = new ItemStack(Material.ENDER_PEARL, 10);
		ItemStack fleches = new ItemStack(Material.ARROW, 10);
		ItemMeta arcmeta = arc.getItemMeta();
		arcmeta.setDisplayName("§f[§bFreezer'Bow§f]");
		ItemMeta flechesmeta = fleches.getItemMeta();
		flechesmeta.setDisplayName("§f[§bFlèches gelées§f]");
		fleches.setItemMeta(flechesmeta);
		arc.setItemMeta(arcmeta);
		
		ItemMeta epeemeta = epee.getItemMeta();
		epeemeta.setDisplayName("§f[§bFreezer'Sword§f]");
		epee.setItemMeta(epeemeta);

		p.getInventory().clear();
		p.getInventory().setHelmet(casque);
		p.getInventory().setLeggings(pantalon);
		p.getInventory().setChestplate(plastron);
		p.getInventory().setBoots(bottes);

		p.getInventory().addItem(epee);
		p.getInventory().addItem(arc);
		p.getInventory().addItem(ender);
		Spawn.givesoupe(p);
		p.getInventory().addItem(fleches);
		
		p.sendMessage("");
		p.sendMessage(Main.name + "Kit: §cFreezer§f | Lvl: §c1§f");
		p.sendMessage("");

		p.setGameMode(GameMode.ADVENTURE);
		p.setHealth(20.0);
		p.setWalkSpeed((float) 0.15);
	}

	public static void lvl2(Player p){

		ItemStack casque = new ItemStack(Material.IRON_HELMET);
		ItemStack plastron = new ItemStack(Material.IRON_CHESTPLATE);
		ItemStack pantalon = new ItemStack(Material.IRON_LEGGINGS);
		ItemStack bottes = new ItemStack(Material.DIAMOND_BOOTS);

		ItemStack epee = new ItemStack(Material.IRON_SWORD);
		ItemStack arc = new ItemStack(Material.BOW);
		ItemStack ender = new ItemStack(Material.ENDER_PEARL, 10);
		ItemStack fleches = new ItemStack(Material.ARROW, 15);
		ItemMeta arcmeta = arc.getItemMeta();
		arcmeta.setDisplayName("§f[§bFreezer'Bow§f]");
		ItemMeta flechesmeta = fleches.getItemMeta();
		flechesmeta.setDisplayName("§f[§bFlèches gelées§f]");
		fleches.setItemMeta(flechesmeta);
		arc.setItemMeta(arcmeta);
		
		p.getInventory().clear();
		p.getInventory().setHelmet(casque);
		p.getInventory().setLeggings(pantalon);
		p.getInventory().setChestplate(plastron);
		p.getInventory().setBoots(bottes);

		p.getInventory().addItem(epee);
		p.getInventory().addItem(arc);
		p.getInventory().addItem(ender);
		Spawn.givesoupe(p);
		p.getInventory().addItem(fleches);
		
		p.sendMessage("");
		p.sendMessage(Main.name + "Kit: §cFreezer§f | Lvl: §c2§f");
		p.sendMessage("");

		p.setGameMode(GameMode.ADVENTURE);
		p.setHealth(20.0);
		p.setWalkSpeed((float) 0.20);
	}
	
	public static void lvl3(Player p){

		ItemStack casque = new ItemStack(Material.IRON_HELMET);
		ItemStack plastron = new ItemStack(Material.IRON_CHESTPLATE);
		ItemStack pantalon = new ItemStack(Material.IRON_LEGGINGS);
		ItemStack bottes = new ItemStack(Material.DIAMOND_BOOTS);

		ItemStack epee = new ItemStack(Material.DIAMOND_SWORD);
		ItemStack arc = new ItemStack(Material.BOW);
		ItemStack ender = new ItemStack(Material.ENDER_PEARL, 10);
		ItemStack fleches = new ItemStack(Material.ARROW, 20);
		ItemMeta arcmeta = arc.getItemMeta();
		arcmeta.setDisplayName("§f[§bFreezer'Bow§f]");
		ItemMeta flechesmeta = fleches.getItemMeta();
		flechesmeta.setDisplayName("§f[§bFlèches gelées§f]");
		fleches.setItemMeta(flechesmeta);
		arc.setItemMeta(arcmeta);
		bottes.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 2);
		arc.addEnchantment(Enchantment.ARROW_DAMAGE, 1);
		
		p.getInventory().clear();
		p.getInventory().setHelmet(casque);
		p.getInventory().setLeggings(pantalon);
		p.getInventory().setChestplate(plastron);
		p.getInventory().setBoots(bottes);

		p.getInventory().addItem(epee);
		p.getInventory().addItem(arc);
		p.getInventory().addItem(ender);
		Spawn.givesoupe(p);
		p.getInventory().addItem(fleches);
		
		p.sendMessage("");
		p.sendMessage(Main.name + "Kit: §cFreezer§f | Lvl: §cmax§f");
		p.sendMessage("");

		p.setGameMode(GameMode.ADVENTURE);
		p.setHealth(20.0);
		p.setWalkSpeed((float) 0.20);
	}

}
